package bsc.ejb.entity;

import java.io.Serializable;
import java.util.Collection;
import java.util.Date;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.JoinTable;
import javax.persistence.ManyToMany;
import javax.persistence.ManyToOne;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author memozac
 */
@Entity
public class SRM implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.AUTO)
    private Long idSRM;

    @Column(columnDefinition="text")
    private String name;

    @Temporal(value = TemporalType.DATE)
    private Date SRMDate;
    
    @Column(columnDefinition="text")
    private String SRMHour;
    
    @Column(columnDefinition="text")
    private String place;
    
    @Column(columnDefinition="text")
    private String responsable;

    private Double expectedTime;
    
    @ManyToMany(targetEntity=Topic.class)
    @JoinTable(name="SRMTopic",
    joinColumns=@JoinColumn(name="idSRM"),
    inverseJoinColumns=@JoinColumn(name="idTopic"))
    private Collection<Topic> topics;

    @ManyToOne
    private ScoreView scoreView;
    
    public Double getExpectedTime() {
        return expectedTime;
    }

    public void setExpectedTime(Double expectedTime) {
        this.expectedTime = expectedTime;
    }

    public String getResponsable() {
        return responsable;
    }

    public void setResponsable(String responsable) {
        this.responsable = responsable;
    }

    public Date getSRMDate() {
        return SRMDate;
    }

    public void setSRMDate(Date SRMDate) {
        this.SRMDate = SRMDate;
    }

    public String getPlace() {
        return place;
    }

    public void setPlace(String place) {
        this.place = place;
    }

    public Long getIdSRM() {
        return idSRM;
    }

    public void setIdSRM(Long idSRM) {
        this.idSRM = idSRM;
    }

    public Collection<Topic> getTopics() {
        return topics;
    }

    public void setTopics(Collection<Topic> topics) {
        this.topics = topics;
    }

    public ScoreView getScoreView() {
        return scoreView;
    }

    public void setScoreView(ScoreView scoreView) {
        this.scoreView = scoreView;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    @Override
    public int hashCode() {
        int hash = 0;
        hash += (idSRM != null ? idSRM.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        if (!(object instanceof SRM)) {
            return false;
        }
        SRM other = (SRM) object;
        if ((this.idSRM == null && other.idSRM != null) || (this.idSRM != null && !this.idSRM.equals(other.idSRM))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return "bsc.ejb.entity.SRM[id=" + idSRM + "]";
    }

    /**
     * @return the SRMHour
     */
    public String getSRMHour() {
        return SRMHour;
    }

    /**
     * @param SRMHour the SRMHour to set
     */
    public void setSRMHour(String SRMHour) {
        this.SRMHour = SRMHour;
    }
}//ends of class
